package 并发编程08.原子操作类;

import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.atomic.AtomicStampedReference;

/**
 * @author idea
 * @data 2019/1/23
 */
public class AtomicDemo2 {

    private static int[] arr={1,2,3};

    private static String[] strArr={"asd","asd","qweq"};
    static AtomicIntegerArray atomicIntegerArray=new AtomicIntegerArray(arr);

    static AtomicReferenceArray atomicReferenceArray=new AtomicReferenceArray(strArr);

    private static String[] arr2={"123","!@#","qwewq"};

    static AtomicReferenceArray atomic=new AtomicReferenceArray(arr2);

    public static void main(String[] args) {
        atomic.getAndSet(0,"1223");
        System.out.println(atomic.get(0));
//        atomicIntegerArray.getAndSet(0,5);
//        System.out.println(atomicIntegerArray.get(0));
//        atomicReferenceArray.getAndSet(0,"idea");
//        System.out.println(atomicReferenceArray.get(0));
//        System.out.println(strArr[0]);

    }
}
